
/**
 * @file raw.c
 * Raw file format
 */

#include "common.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "pcm.h"

int raw_probe(uint8_t *data, int size)
{
    if (data == NULL || size < 0)
        return 0;
    return 1;
}

int raw_init(PcmFile *pf)
{
    pf->data_size = 0;
    pf->data_start = 0;
    if (pf->seekable && pf->file_size > 0) {
        pf->data_size = pf->file_size;
    }
    pf->read_to_eof = 1;

    pcmfile_set_source_params(pf, 1, PCM_SAMPLE_FMT_S16, PCM_BYTE_ORDER_LE,
                              48000);
    return 0;
}

PcmFormat raw_format = {
    "raw",
    "Raw PCM",
    PCM_FORMAT_RAW,
    raw_probe,
    raw_init,
    NULL
};
